home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / gnulib / libsrc98.zoo / lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-29  |  3.7 KB  |  132 lines

  1. /*
  2.  * library-specific stuff
  3.  */
  4. #ifndef _LIB_H
  5. #define _LIB_H
  6.  
  7. #ifndef _COMPILER_H
  8. #include <compiler.h>
  9. #endif
  10.  
  11. #include <stdio.h>    /* for FILE   */
  12. #include <time.h>    /* for time_t */
  13.  
  14. /* filename mapping function type */
  15. #ifndef __FNMAP
  16. #define __FNMAP
  17. typedef int (*fnmapfunc_t) __PROTO((const char *, char *));
  18. #endif
  19.  
  20. __EXTERN int        _unx2dos __PROTO((const char *, char *));
  21. __EXTERN int        _dos2unx __PROTO((const char *, char *));
  22. #ifndef __MINT__
  23. __EXTERN int        unx2dos __PROTO((const char *, char *));
  24. __EXTERN int        dos2unx __PROTO((const char *, char *));
  25. __EXTERN void        fnmapfunc __PROTO((fnmapfunc_t u2dos, fnmapfunc_t dos2u));
  26. #endif
  27.  
  28. __EXTERN long        _write      __PROTO((int, const void *, unsigned long));
  29. __EXTERN long        _read      __PROTO((int, void *, unsigned long));
  30. #ifndef __MINT__
  31. __EXTERN int        console_input_status __PROTO((int));
  32. __EXTERN unsigned int    console_read_byte __PROTO((int));
  33. __EXTERN void        console_write_byte __PROTO((int, int));
  34. #else
  35. __EXTERN int    _console_read_byte __PROTO((int));
  36. __EXTERN void    _console_write_byte __PROTO((int, int));
  37. #endif
  38.  
  39. __EXTERN time_t        _dostime __PROTO((time_t));
  40. __EXTERN time_t        _unixtime __PROTO((unsigned int, unsigned int));
  41.  
  42. __EXTERN char *        _itoa __PROTO((int, char *, int));
  43. __EXTERN char *        _ltoa __PROTO((long, char *, int));
  44. __EXTERN char *        _ultoa __PROTO((unsigned long, char *, int));
  45.  
  46. __EXTERN int        _doprnt __PROTO((int (*)(int, FILE *), FILE *, const char *, __VA_LIST__));
  47.  
  48. #ifdef __MINT__
  49. __EXTERN int    _scanf __PROTO((FILE *, int (*)(FILE *),
  50.             int (*)(int, FILE *), const char *, __VA_LIST__));
  51. __EXTERN int    _enoent __PROTO((char *));
  52. #endif
  53.  
  54. __EXTERN long        get_sysvar __PROTO((void *var));
  55. __EXTERN void        set_sysvar_to_long __PROTO((void *var, long val));
  56.  
  57. __EXTERN void    _main        __PROTO((long, char **, char **));
  58. __EXTERN void    _init_signal    __PROTO((void));
  59. __EXTERN void     _monstartup    __PROTO((void *lowpc, void *highpc));
  60. __EXTERN void    __mcleanup    __PROTO((void));
  61. __EXTERN void    _moncontrol    __PROTO((long));
  62. __EXTERN void    _setstack    __PROTO((char *));
  63. __EXTERN void    _crtinit    __PROTO((void));
  64. __EXTERN void    _acc_main    __PROTO((void));
  65. __EXTERN __EXITING    __exit    __PROTO((long status)) __NORETURN;
  66.  
  67. __EXTERN void    _fclose_all_files __PROTO((void));
  68. /* from the TOS GCC library */
  69. /* 5/5/92 sb -- definitions needed in malloc.c and realloc.c */
  70.  
  71. struct mem_chunk 
  72.     {
  73.     long valid;
  74. #define VAL_FREE  0xf4ee0abcL
  75. #define VAL_ALLOC 0xa11c0abcL
  76.  
  77.     struct mem_chunk *next;
  78.     unsigned long size;
  79.     };
  80.  
  81. /* linked list of free blocks */
  82.  
  83. extern struct mem_chunk _mchunk_free_list;
  84.  
  85. /* status of open files (for isatty, et al.) */
  86.  
  87. #ifdef __MINT__
  88.  
  89. #define __NHANDLES 40
  90.  
  91. struct __open_file {
  92.     short    status;        /* whether or not it's a tty */
  93.     short    flags;        /* if a tty, its flags */
  94. };
  95.  
  96. #else
  97.  
  98. #define __NHANDLES    80
  99. struct __open_file {
  100.     unsigned short append:1;    /* 1 if O_APPEND set for this file */
  101.     unsigned short nodelay:1;    /* 1 if O_NDELAY set for this file */
  102.     unsigned short pipe:1;      /* 1 if O_PIPE set for this file */
  103.     unsigned short eclose:1;    /* 1 if close on exec is set for this file */
  104.     unsigned short status:2;    /* status FH_UNKNOWN | ISATTY | ISAFILE */
  105.     char       *filename;    /* filename of open file */
  106. };
  107.  
  108. #endif /* __MINT__ */
  109.  
  110. extern struct __open_file __open_stat[];
  111.   /* NOTE: this array is indexed by (__OPEN_INDEX(fd)) */
  112.  
  113. #define __OPEN_INDEX(x)    (((short)(x)) + 3)
  114.  
  115. #define FH_UNKNOWN    0
  116. #define FH_ISATTY    1
  117. #define FH_ISAFILE    2
  118.  
  119. /*
  120.  * macro for converting a long in DOS format to one in Unix format. "x"
  121.  * _must_ be an lvalue!
  122.  */
  123. #define __UNIXTIME(x) (x = _unixtime( ((short *)&x)[0], ((short *)&x)[1] ))
  124.  
  125. __EXTERN int _do_lock __PROTO((int fd, int cmd, long size, int whence));
  126.  
  127. #ifdef _STDIO_H
  128. __EXTERN FILE *_fopen_i __PROTO((const char *, const char *, FILE *));
  129. #endif
  130.  
  131. #endif /* _LIB_H */
  132.